#pragma once

#include"HashTable.h"
using namespace hash_bucket;



template<class K, class V, class Hash = HashFunc<K>, class Pred = Equal_to<K>>
class unordered_map
{
	typedef pair<const K, V> valueoftype;

	struct KeyOfMap
	{
		const K& operator()(const valueoftype& val) const
		{
			return val.first;
		}
	};
public:
	typedef typename HashTable<K, valueoftype, KeyOfMap, Hash, Pred>::Iterator iterator;
	typedef typename HashTable<K, valueoftype, KeyOfMap, Hash, Pred>::ConstIterator const_iterator;

	iterator begin()
	{
		return _map.Begin();
	}

	iterator end()
	{
		return _map.End();
	}

	const_iterator begin() const
	{
		return _map.Begin();
	}

	const_iterator end() const
	{
		return _map.End();
	}

	bool insert(const valueoftype& val)
	{
		return _map.insert(val);
	}

	bool erase(const K& key)
	{
		return _map.erase(key);
	}
private:
	HashTable<K, valueoftype, KeyOfMap, Hash, Pred> _map;
};